import sys
import getopt
import string
import time

# Local 
import collect_data
import util
import constants

class HumanActivityRecognition: 
    def __init__(self,mode,iface,freq=None):
        # This class can be used for human activity recognition.
        self.iface = iface
        self.mode = mode
	self.freq= freq


    def initiate(self):
        # All the code related to object initiation etc. should be here
        print "Starting Activity Recognition System"
        if_macs = util.getmacs()
        wireless_ifs = util.find_interfaces(constants.WIRELESS_STR)
        print wireless_ifs
    	# --
    	# Enable this code segment for live traffic
    	# --
        if(self.mode ==constants.RUN_MODE):
            cd_pcap = collect_data.CollectData(self.iface,if_macs,wireless_ifs,self.freq)
            cd_pcap.setAPMACs()
            cd_pcap.get_associated_clients() # For initial start we might not have anything here
            cd_pcap.sniff() # hopefully you have done all the hw
            # These functions are generic
            cd_pcap.setAPMACs()
    	# --
    	# -- This code can be used to test the pcap fils based data 
    	# --
        if(self.mode ==constants.DEBUG_MODE):
            cd_pcap = collect_data.CollectData(self.iface,if_macs, wireless_ifs,"temp.pcap")
            cd_pcap.setAPMACs()
            cd_pcap.loadpcap()
            cd_pcap.printpcap()
            cd_pcap.getDevices()
            # These functions are generic
            cd_pcap.setAPMACs()
            pass
